﻿
--|--------------------------------------------------------------------------------
--| [CopyGame] - Insert Procedure Script for Game
--|--------------------------------------------------------------------------------
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id (N'[dbo].[CopyGame]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1) 
  DROP PROCEDURE [dbo].[CopyGame]
GO

CREATE PROCEDURE [dbo].[CopyGame]
(
	@NewGameID int ,
	@OldGameID int
)
AS
	SET NOCOUNT ON

	INSERT INTO [GameEntity]
	(
	[GameID],
	[EntityID],
	[ParentGameEntityID],
	[GameRoleID],
	[Visible]
	)
	SELECT @NewGameID,
		[EntityID],
		[ParentGameEntityID],
		[GameRoleID],
		[Visible]
	FROM [GameEntity]  WHERE GameID = @OldGameID
	
	RETURN @@Error
GO
  